import system from '@/views/system/route'
import user from '@/views/user/route'
import taskClassify from '@/views/task-classify/route'
import banner from '@/views/banner/route'
import taskCycle from '@/views/task-cycle/route'
import withdraw from '@/views/withdraw/route'
import setting from '@/views/setting/route'
import bill from '@/views/bill/route'
import leaderboard from '@/views/leaderboard/route'
import task from '@/views/task/route'

// 由于懒加载页面太多的话会造成webpack热更新太慢，所以开发环境不使用懒加载，只有生产环境使用懒加载
// const _import = require('@/libs/util.import.' + process.env.NODE_ENV)
const _import = require('@/libs/util.import.' + process.env.NODE_ENV)

/**
 * 在主框架内显示
 */
const frameIn = [
  ...system,
  ...user,
  ...taskClassify,
  ...banner,
  ...taskCycle,
  ...withdraw,
  ...setting,
  ...bill,
  ...leaderboard,
  ...task
]

/**
 * 在主框架之外显示
 */
const frameOut = [
  // 登录
  {
    path: '/login',
    name: 'login',
    component: _import('system/login')
  }
]

/**
 * 错误页面
 */
const errorPage = [
  {
    path: '*',
    name: '404',
    component: _import('system/error/404')
  }
]

// 导出需要显示菜单的
export const frameInRoutes = frameIn

// 重新组织后导出
export default [
  ...frameIn,
  ...frameOut,
  ...errorPage
]
